<?php
/**
 * Created by PhpStorm.
 * User: JinLei
 * Date: 2018/1/29
 * Time: 15:31
 */
namespace Home\Model;
use Think\Model;
class QuestionModel extends Model{
    /**
     * @param $id
     * @return mixed
     * 获取问题信息
     */
    public function getQuest($id){
        $where['surveyid'] = $id;
        return $this->where($where)->select();
    }

    /**
     * @param $id
     * @return mixed
     * 获取问题类型
     */
    public function getType($id){
        return $this->field('questiontype')->find($id);
    }

    /**
     * @param $sid
     * @return mixed
     * 获取必填项题目id $sid 问卷id
     */
    public function getRequire($sid){
        $where['surveyid'] = $sid;
        $where['isrequired'] = '1';
        return $this->where($where)->select();
    }
}